package jmine.tec.rpc.client;

import jmine.tec.rpc.client.comm.AOPClientStubFactory;
import jmine.tec.rpc.client.provider.ClientStubFactory;
import jmine.tec.rpc.common.serialization.Serializer;
import jmine.tec.test.Builder;
import jmine.tec.utils.io.http.Connector;

/**
 * Builder de ClientStubFactory
 * 
 * @author lundberg
 */
public class ClientStubFactoryBuilder implements Builder<ClientStubFactory> {
    private Connector connector;

    private Serializer serializer;

    private String basePath;

    /**
     * @return ClientStubFactoryBuilder
     */
    public static ClientStubFactoryBuilder aClientStubFactory() {
        return new ClientStubFactoryBuilder();
    }

    /**
     * {@inheritDoc}
     */
    public ClientStubFactory build() {
        AOPClientStubFactory factory = new AOPClientStubFactory();
        factory.setConnector(this.connector);
        factory.setSerializer(this.serializer);
        factory.setBasePath(this.basePath);
        return factory;
    }

    /**
     * @param aConnector aConnector
     * @return ClientStubFactoryBuilder
     */
    public ClientStubFactoryBuilder with(Connector aConnector) {
        this.connector = aConnector;
        return this;
    }

    /**
     * @param aSerializer aSerializer
     * @return ClientStubFactoryBuilder
     */
    public ClientStubFactoryBuilder with(Serializer aSerializer) {
        this.serializer = aSerializer;
        return this;
    }

    /**
     * @param aBasePath basePath
     * @return ClientStubFactoryBuilder
     */
    public ClientStubFactoryBuilder with(String aBasePath) {
        this.basePath = aBasePath;
        return this;
    }

}
